import http from '@/utils/RequestUtils';

export interface CodeRequestType {
  current?: number | string
  size?: number | string
  [key: string]: any
}

const commonUrl = `${import.meta.env.VITE_API_BASE_FOUNDATION}/api/perm/role`;
const userCommonUrl = `${import.meta.env.VITE_API_BASE_FOUNDATION}/api/perm/role-user`;

export function getRoleList(data: any) {
  return http.post(`${commonUrl}/list`, data);
}

export function getAssignUserList(data: any) {
  return http.post(`${userCommonUrl}/assigned-users`, data);
}

export function getInheritRoleList(data: any) {
  return http.post(`${commonUrl}/inheritable-roles`, data);
}

export function saveRoleData(data: any) {
  return http.post(`${commonUrl}/save`, data);
}

export function updateStatus(data: any) {
  return http.post(`${commonUrl}/update-status`, data);
}

export function queryOrgList(data: any) {
  return http.post(`${import.meta.env.VITE_API_BASE_FOUNDATION}/api/v1/extend-org/load`, data);
}

export function addAssignUser(data: any) {
  return http.post(`${userCommonUrl}/add-assigned-users`, data);
}

export function deleteAssignUser(data: any) {
  return http.post(`${userCommonUrl}/del-assigned-users`, data);
}

export function deleteRoles(data: any) {
  return http.post(`${commonUrl}/delete`, data);
}
